<template>
  <div class="setting_frame" @touchstart.stop="no" @touchstop.stop="no" >
    <el-menu
      class="el-menu-vertical-demo"
      :collapse="true"
    >
      <el-submenu index="1">
        <template slot="title">
          <i class="el-icon-user-solid"></i>
          <span>用户设置</span>
        </template>
        <el-menu-item index="1-1" @click="handleClick('userinfo_show')">个人信息</el-menu-item>
        <el-menu-item-group>
          <template slot="title">账户设置</template>
          <el-menu-item index="1-2">用户名修改</el-menu-item>
          <el-menu-item index="1-3">密码修改</el-menu-item>
        </el-menu-item-group>
      </el-submenu>
      <el-submenu index="2">
        <template slot="title">
            <i class="el-icon-s-tools"></i>
          <span>系统设置</span>
        </template>
        <el-menu-item-group>
          <template slot="title">个性设置</template>
          <el-menu-item index="2-2"
           @click="handleClick('backimg_show')"
           >背景设置</el-menu-item>
          <el-menu-item index="2-3">主题设置</el-menu-item>
        </el-menu-item-group>
      </el-submenu>
      <el-menu-item index="3" @click="handleClick('about_show')">
    <i class="el-icon-link"></i>
    <span slot="title">关于网站</span>
  </el-menu-item>
    </el-menu>
    <UserInfo v-show="showObj.userinfo_show"></UserInfo>
    <BackImg v-show="showObj.backimg_show"></BackImg>
    <About v-show="showObj.about_show"></About>
  </div>
</template>

<script>
import UserInfo from '../setting/UserInfo'
import BackImg from '../setting/BackImg.vue'
import About from '../setting/About'
export default {
  name: "Setting",
  data() {
    return {
        showObj:{
            userinfo_show:true,
            backimg_show:false,
            about_show:false,
            show_now:'userinfo_show'
        }
    };
  },
  components:{
    UserInfo,
    BackImg,
    About
  },
  methods:{
    handleClick(key){
      this.showObj[this.showObj.show_now] = false
      this.showObj[key] = true 
      this.showObj.show_now = key
    }
  }
};
</script>

<style lang="less" scoped>
.setting_frame {
  width: 100%;
  height: 100%;
}
/deep/.el-menu--collapse {
  width: 10%;
  height: 100%;
  border-right: 1px solid #ccc;
  float:left
}
</style>